<?php
require_once('class.phpmailer.php');

function sendEmail($email){
	
	error_reporting(E_STRICT);
	
	date_default_timezone_set('Asia/Calcutta');
	
	
	$mail             = new PHPMailer();
	//echo "Email: $email";
	//" Please use the following unique verification code to complete the registration process.<br/>" .
	//"Verfication Code: <b>$vcode<b/> <br/>".
	
	$body =  "Thank you for choosing LifeInClass.!<br/><br/>" .
			"Please <a href=\"http://www.lifeinclass.com/verify.php?whom=school&email=$email\" target=\"_blank\">click here</a> to verify your email address.<br/><br/>".

			"Best Regards,<br/>".
			"- SmartKids HelpDesk.<br/>".
			"-------------------------------------------------------------------<br/>".
			" This is an auto generated email. Please DONOT reply.<br/>".
			"-------------------------------------------------------------------<br/>";
	
	
	$mail->IsSMTP(); // telling the class to use SMTP
	$mail->SMTPAuth   = true;                  // enable SMTP authentication
	$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
	$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
	$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
	$mail->Username   = "smartkidseduportal@gmail.com";  // GMAIL username
	$mail->Password   = "smartkids123";            // GMAIL password
	
	$mail->SetFrom('smartkidseduportal@gmail.com', 'LifeInClass HelpDesk');
	
	$mail->AddReplyTo("smartkidseduportal@gmail.com","LifeInClass HelpDesk");
	
	$mail->Subject    = "[LifeInClass] School registration successful.";
	
	$mail->MsgHTML($body);
	
	$mail->AddAddress($email, "New School");
	
	$ret = $mail->Send();
	
	if(!$ret) {
	  return "{\"success\":\"false\",\"message\":\"". $mail->ErrorInfo . "\"}";
	} 

	return "{\"success\":\"true\",\"message\":\"Sent email to ". $email . "\"}";
}

?>

